import { config } from '../../config/index';
import util from "../../utils/util.js"

/** 获取搜索历史 */
export function getSearchHistory() {
	return util.request({
		url: "/goods/searchHistory",
		method: 'post',
	})
}

/** 获取搜索历史 */
function mockSearchPopular() {
	const { delay } = require('../_utils/delay');
	const { getSearchPopular } = require('../../model/search');
	return delay().then(() => getSearchPopular());
}

/** 获取搜索历史 */
export function getSearchPopular() {
	if (config.useMock) {
		return mockSearchPopular();
	}
	return new Promise((resolve) => {
		resolve('real api');
	});
}
